package com.itheima.d4_byte__stream;

import java.io.File;
import java.io.FileInputStream;
import java.io.InputStream;

public class FileInputStreamTest3 {
    public static void main(String[] args) throws Exception {
        //1.一次性读取完全部字节
        //创建文件字节输入流管道
        InputStream fileInputStream = new FileInputStream("D:\\Java\\JavaEE_learn\\IO_learn\\src\\main\\java\\com\\itheima\\itheima03.txt");

//        //2.准备一个和文件一样的字节数组
//        File f = new File("D:\\Java\\JavaEE_learn\\IO_learn\\src\\main\\java\\com\\itheima\\itheima03.txt");
//        long sizes = f.length();
//        byte[] buffer = new byte[(int) sizes];
//        int len = fileInputStream.read(buffer);
//        System.out.println(new String(buffer));
//
//        System.out.println(sizes);
//        System.out.println(len);

        byte[] bytes = fileInputStream.readAllBytes();
        System.out.println(new String(bytes));

    }
}
